package com.summer.Collection.msb;
import com.sun.javaws.IconUtil;

import java.util.*;

public class Test01 {
    public static void main(String[] args) {

        Collection col = new ArrayList();
        col.add(18);
        col.add(12);
        col.add(17);
        col.add(11);
        System.out.println(col);
        List<Integer> list = Arrays.asList(new Integer[]{1, 2, 3, 4, 5});
        col.addAll(list);
        System.out.println(col);
        col.remove(5);
        System.out.println(col);
        //遍历方式一
        for (Object o:col
             ) {
            System.out.print(o+" ");
        }
        System.out.println();
        //遍历方式一
        Iterator iterator = col.iterator();
        while (iterator.hasNext()){
            System.out.print(iterator.next()+" ");
        }
        System.out.println();
        col.clear();
        System.out.println(col);

    }
}
